<?php

// +----------------------------------------------------------------------
// | Copyright (c) 2020 All rights reserved.
// +----------------------------------------------------------------------
// | User: Simony <1362229026@qq.com>
// | wechat: Shen86579595
// +----------------------------------------------------------------------
namespace app\mobileapp\controller;

class Need extends Base
{


    /**
     * User: Simony
     * Function:首页
     */
    public function index()
    {
        $memberId = $this->memberId;
        //get params
        $categroy = input('post.categroy/d', 1);
        $is_online = input('post.is_online/d', 0);
        $show_type = input('post.show_type/d', -1);
        $page_size = input('post.per_page/d', 10);
        $longitude = input('post.longitude', 113.278121);
        $latitude = input('post.latitude', 23.135911);
        $area_id = input('post.area_id/d', -1);
        $level = input('post.level/d', -1);

        if (!in_array($categroy, [1, 2, 3, 4])) api_json_encode(400, '类型有误');
        if (!in_array($show_type, [-1, 1, 2])) api_json_encode(400, '性别传入有误');

        //model or logic
        $memberLogic = model('common/member/MemberLogic', 'logic');

        $memberLogic->updateLngLat($memberId, $longitude, $latitude);

        //get data
        $res = $memberLogic->getMemberListByType($memberId, $area_id, $categroy, $show_type, $is_online, $level, $page_size);

        //return
        $this->api_ajaxReturn($res['code'], $res['msg'], $res['result']);
    }




}
